<%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%>
<%
String path = request.getContextPath();
String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/";
%>

<html  lang="en" dir="ltr">
  <head>
	 <title>系统登录</title>
    <meta http-equiv="keywords" content="keyword1,keyword2,keyword3">
    <meta http-equiv="description" content="this is my page">
    <meta http-equiv="content-type" content="text/html; charset=UTF-8">
   
    <link rel="stylesheet" href="<%=path%>/source/CSS/login_1.css" type="text/css">
	<link rel="stylesheet" href="<%=path%>/source/CSS/login_2.css" type="text/css">
	<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/5.8.2/css/all.min.css" type="text/css">
  </head>
  
  <body>
      <%
	String RegYes = (String)request.getAttribute("regYes");
	String RegError = (String)request.getAttribute("regError");
	String LogError = (String)request.getAttribute("logError");
	if(RegYes!=null) {
		out.print(RegYes);
	}
 	if(RegError!=null) {
		out.print(RegError);
	}
	if(LogError!=null) {
		out.print(LogError);
	}
	%>
  
  
  
	<div class="dowebok" id="dowebok">
        <div class="form-container sign-up-container">
            <form action="<%=request.getContextPath() %>/servlet/Register" method="post" onsubmit="return regcheckForm()">
                <h1>注册</h1>
                <div class="social-container">
                    <a href="#" class="social"><i class="fab fa-facebook-f"></i></a>
                    <a href="#" class="social"><i class="fab fa-google-plus-g"></i>    </a>
                    <a href="#" class="social"><i class="fab fa-linkedin-in"></i></a>
                </div>
                <span>或使用邮箱注册</span>
                <input id="regtext" type="text" placeholder="姓名" name="regtext">
                <input id="regid"  type="id" placeholder="ID" name="regid">
                <input id="regpsw" type="password" placeholder="密码" name="regpsw">
                <font id="regerror" color="red"></font>
                <input type="submit" value="注册" class="sub" name="regs"/>
            </form>
        </div>
        <div class="form-container sign-in-container">
            <form action="<%=request.getContextPath() %>/servlet/Login" method="post" onsubmit="return logcheckForm()"> 
                <h4>ChrosWine红酒有限公司-管理登录</h4>
                <div class="social-container">
                    <a href="#" class="social"><i class="fab fa-facebook-f"></i></a>
                    <a href="#" class="social"><i class="fab fa-google-plus-g"></i></a>
                    <a href="#" class="social"><i class="fab fa-linkedin-in"></i></a>
                </div>
                <span>或使用您的帐号</span>
                <input id="logstuCode" type="text" placeholder="账号" name="logstuCode" >
                <input id="logpsw" type="password" placeholder="密码" name="logpsw">
                <label class="checkbox" style="width:200px">
                	<input id="remember" name="remember" type="checkbox"/>记住我
                </label>
                	<font id="logerror" color="red"></font>
                <input type="submit" value="登录" class="sub" name="login"/>
            </form>
        </div>
        <div class="overlay-container">
            <div class="overlay">
                <div class="overlay-panel overlay-left">
                    <h1>已有帐号？</h1>
                    <p>请使用您的帐号进行登录</p>
                    <button class="ghost" id="signIn">登录</button>
                </div>
                <div class="overlay-panel overlay-right">
                    <h1>没有帐号？</h1>
                    <p>立即注册加入我们，和我们一起开始旅程吧</p>
                    <button class="ghost" id="signUp">注册</button>
                </div>
            </div>
        </div>
    </div>

    <script src="<%=path%>/source/JS/login_1.js"></script>

    
    <script type="text/javascript">
    	function logcheckForm(){
    		var stuCode = document.getElementById("logstuCode").value;
    		var passWord = document.getElementById("logpsw").value;
    		if(passWord==null || passWord==""){
    			document.getElementById("logerror").innerHTML="密码不能为空";
    			return false;
    		}else if(stuCode==null || stuCode==""){
    			document.getElementById("logerror").innerHTML="账号不能为空";
    			return false;
    		}else{
    			return true;
    		}
    				
    	}
    	function regcheckForm(){
    		var regText = document.getElementById("regtext").value;
    		var regEmail = document.getElementById("regemail").value;
    		var regpassWord = document.getElementById("regpsw").value;
    		if(regpassWord==null || regpassWord==""){
    			document.getElementById("regerror").innerHTML="密码不能为空";
    			return false;
    		}else if(regEmail==null || regEmail==""){
    			document.getElementById("regerror").innerHTML="邮箱不能为空";
    			return false;
    		}else if(regText==null || regText==""){
    			document.getElementById("regerror").innerHTML="用户名不能为空";
    			return false;
    		}else{
    			return true;
    		}	
    	}
    </script>
  </body>
</html>
